import req from '@/utils/request'
import * as URL from '@/constants/api'

// 文章数据
export function getArticleList(id) {
  return req ({
    url: URL.ARTICLE_LIST,
    params: {
      channel_id: id,
      timestamp: Date.now(),
    }
  })
    .then(res => res.data.data.results)
    // .then(res => [])
    .catch(() => [])
}

// 获取新闻详情
export function getArticles(id) {
  return req ({
    url: `${URL.ARTICLES}/${id}`,
  })
    .then(res => res)
    .catch(() => [])
}
